package com.sanshow.charging.data;


import com.blankj.utilcode.util.SPUtils;
import com.sanshow.charging.util.DeviceUtil;
import com.sanshow.charging.util.StringUtil;
import com.xuhao.didi.core.iocore.interfaces.IPulseSendable;

import org.json.JSONException;
import org.json.JSONObject;

import java.nio.charset.Charset;

public class PulseBean implements IPulseSendable {
    private String str = "";

    public PulseBean() {

        String deviceCode = DeviceUtil.getSerialNumber();
        //String hexString = Integer.toHexString(Integer.parseInt(deviceCode));
        String deviceSN = StringUtil.formatWithMakingUp(deviceCode);

        StringBuilder message = new StringBuilder();
        message.append("61");
        message.append("00");
        message.append(deviceSN);
        message.append("AA");
        message.append("00");
        message.append("A0");
        message.append("00");
        message.append("00");
        message.append("00");
        message.append("00");
        message.append("00");
        message.append("00");
        message.append("C1");
        message.append("D1");
        message.append("00");
        message.append("DF");
        message.append("DF");

        str = message.toString();
    }

    @Override
    public byte[] parse() {
        byte[] body = str.getBytes(Charset.defaultCharset());
        return body;
    }

}